<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中奖名单</title>
    <style type="text/css">
        body {
            width:100%;
            min-height:100%;
            background-size: 100% 100%;
            -webkit-background-size: 100% 100%;
            background: url(img/bg2.jpg);
            font-family: "宋体";
        }
    </style>
</head>
<body>
<div id="mingdan"  style="text-align: center" >
    <div class="lucky_people_title" style="font-size: 80px;color: gold">
        中奖名单汇总
    </div>
    <div>
        <table  border="1" cellspacing="0" id="prizes" style="text-align: center;margin:auto;
        border: black;font-size: x-large;color: gold"></table>
    </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">

    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]);
        return null; //返回参数值
    }
    window.onload = function () {
        var type = getUrlParam("type");
        $.ajax({
            type:"get",
            // url:"https://api.wellcode.cn/luck/drawed",
            url:"http://localhost:8088/luck/drawed",
            data:{"type":type},
            dataType:'json',
            async:true,
            success:function (data) {
                if(data.length>0){
                    var html1 = "<tr><td>名字</td><td>奖品</td></tr>";
                    $("#prizes").append(html1);
                    for (let i = 0; i <data.length ; i++) {
                        console.log(data[i])
                        var name=   data[i].name;
                        var prize =  data[i].prize;
                        var html = "<tr><td>"+name+"</td><td>"+prize+"</td></tr>";
                        $("#prizes").append(html);
                    }
                }
            }
        })
    }

</script>
</body>
</html>